package cn.hanyx.coder.design.pattern.creational.singleton;

import java.util.concurrent.atomic.AtomicLong;

/**
 * IdEnum
 *
 * @author hanyx
 * @date 2020/07/13
 */
public enum IdEnum {
    INSTANCE;
    private AtomicLong id = new AtomicLong(0);

    public long getId() {
        return id.incrementAndGet();
    }

    public static void main(String[] args) {
        System.out.println(IdEnum.INSTANCE.getId());
    }
}
